import axios from 'axios';
import {ajax,base} from './config'

export const getLoginCount = params => { return ajax.getMinData({url:`${base}mapController/getLoginCount.do`, params}); };

export const requestLogin = params => { return axios.post(`${base}loginController.do?checkuser`, params) };

export const getUserList = params => { return axios.get(`${base}user/list`, { params: params }); };

export const getUserListPage = params => { return axios.get(`${base}user/listpage`, { params: params }); };

export const removeUser = params => { return axios.get(`${base}user/remove`, { params: params }); };

export const batchRemoveUser = params => { return axios.get(`${base}user/batchremove`, { params: params }); };

export const editUser = params => { return axios.get(`${base}user/edit`, { params: params }); };

export const addUser = params => { return axios.get(`${base}user/add`, { params: params }); };

// loginController.do?checkuser
// export const checkuser = params => { return ajax.postData({url:`${base}loginController.do?checkuser`, params}); };



/*登录*/
export const getRandCode = params => { return ajax.getMinData({url:`${base}loginController.do?getRandCode`, params}); };
/**
*首页接口
*/
//地图添加变电站标注，参数->sbId：
export const getStationIcon = params => { return ajax.getMinData({url:`${base}api/task/getTaskCountOfSbId.do`,params}) };
//地图添加任务标注，参数->longitude:经度,latitude:纬度,departId:部门Id  api/map.do?getTaskList
export const getTaskIcon = params => { return ajax.getMinData({url:`${base}api/map/getTaskList.do`,params}) };
//地图添加人员标注，参数 api/map.do?getWorkerList
export const getWorkerIcon = params => { return ajax.getMinData({url:`${base}api/map/getWorkerList.do`,params}) };
//api/map.do?getWorkerListSum
export const getWorkerListSum = params => {return ajax.getMinData({url:`${base}api/map/getWorkerListSum.do`,params})};
//  api/map.do?getSubList
export const getSubList = params => {return axios.post(`${base}/bsSubstationController/getList.do`,params)};
// api/map.do?getTaskListSum
export const getTaskListSum = params => {return ajax.getMinData({url:`${base}api/map/getTaskListSum.do`,params})};
//变电站类型，参数：departId
export const getSubTypes = params => { return ajax.getMinData({url:`${base}bsSubstationController/getSubTypes.do`,params}) };
//部门树形菜单
export const getOtherDepart = params => { return axios.post(`${base}api/map.do?getOtherDepart`,params) };
//办公通知，参数:departId
export const getWorkNotice = params => { return ajax.getMinData({url:`${base}announcementController/getAnnouncementList.do`,params}); };
//非主设备问题库，参数:departId
export const getProblemCtrl = params => { return ajax.getMinData({url:`${base}equipmentProblemController/problemForMap.do`, params}); };
//值班安排及今天任务
export const getWorkInfo = params => { return axios.post(`${base}api/map.do?getLoginPageRight`, params); };
//安全学习，参数：departId
export const getLearning = params => { return axios.post(`${base}learningController/getIndexLearningList.do`, params); };
//人员履历人员列表，参数:departId
export const getGroupUser = params => { return axios.post(`${base}groupUserController.do?getAnnouncementList`, params); };
//人员履历人员信息，参数：userId
export const getUserInfo = params => { return axios.post(`${base}tbTaskController/finishUserInfo.do`, params); };



/**
*排版管理接口
*/
//工作组
export const getAllGroup = params => { return axios.post(`${base}userGroupController/getAllGroup.do`, params); };
//部门人员
export const groupAndUserData = params => { return axios.post(`${base}groupUserController.do?groupAndUserDataGrid`, params); };
//工作组排班管理提交
export const addGroupScheduiling = params => { return axios.post(`${base}tbScheduleController.do?addScl4groupOfgroupId`, params); };
//变电人员排班管理提交
export const addWorkerScheduiling = params => { return axios.post(`${base}tbScheduleController.do?addScl4group`, params); };
//获取个人排班数据
export const getScheduilingData = params => { return axios.post(`${base}tbTaskController/getCrewPerList.do`, params); };
//获取部门排班数据tbScheduleController.do?getDepartSch
export const getDepartSch = params => { return axios.post(`${base}tbScheduleController/getDepartSch.do`, params); };
//查看当日值班人员信息api/task/findScl4groupOfId2List.do
export const getCurrentWorker = params => { return axios.post(`${base}tbScheduleController/findScl4groupOfId2List.do`, params); };
//删除值班人员
export const delWorker = params => { return axios.post(`${base}tbScheduleController.do?delScl4per`, params); };



/**
*用户组
*/
//用户组列表数据
export const userGroupData = params => { return axios.post(`${base}userGroupController.do?datagrid`, params); };
//删除用户组
export const userGroupDel = params => { return axios.post(`${base}userGroupController.do?doDel`, params); };
//录入用户组，参数：deptName，deptId，userGroupName
export const userGroupAdd = params => { return axios.post(`${base}userGroupController.do?doAdd`, params); };
//批量删除，参数：ids
export const userGroupBatchDel = params => { return axios.post(`${base}userGroupController.do?doBatchDel`, params); };
//编辑用户组
export const userGroupEdit = params => { return axios.post(`${base}userGroupController.do?doUpdate`, params); };
//获取用户列表
export const getUserTable = params => { return axios.post(`${base}groupUserController.do?datagrid`, params); };
//删除用户
export const userDel = params => { return axios.post(`${base}groupUserController.do?doDel`, params); };
//可添加用户的列表
export const addUserToGroupList = params => { return axios.post(`${base}groupUserController.do?addUserToGroupList`, params); };
//添加用户提交，参数：userIds
export const doAddUserToGroupList = params => { return axios.post(`${base}groupUserController.do?doAddUserToGroupList`, params); };



/**
*任务管理
*/
//任务列表数据
export const getAllTaskData = params => { return axios.post(`${base}api/tbNewTaskController/tasks.do`, params); };
//变电站下拉菜单数据 bsSubstationController.do?getList
export const getSubstationList = params => { return axios.post(`${base}bsSubstationController/getList.do`, params); };
//生产类/非生产类列表数据  tbTaskController/getPlanTypeList.do
export const getUnproductiveList = params => { return axios.post(`${base}api/tbTacheTypeController/typeTree.do`, params); };
//获取站务日志记录
export const subtationLog = params => { return axios.post(`${base}tbTaskController/subtationLog.do?`, params); };



//车辆管理
export const getCarsList = params => { return axios.post(`${base}api/bsCarController.do?datagrid`, params); };

export const removeCars = params => { return axios.post(`${base}api/bsCarController.do?doDel`, params); };

export const batchRemoveCars = params => { return axios.post(`${base}api/bsCarController.do?doBatchDel`, params); };

export const editCars = params => { return axios.post(`${base}api/bsCarController.do?doUpdate`, params); };

export const addCars = params => { return axios.post(`${base}api/bsCarController.do?doAdd`, params); };

export const updateCars = params => { return axios.post(`${base}api/bsCarController.do?exportXlsByT`, params); };

export const getDepart = params => { return axios.post(`${base}api/map.do?getOtherDepart`, params); };


//变电站
export const getsubList = params => { return axios.post(`${base}bsSubstationController.do?datagrid`, params); };

export const removeList = params => { return axios.post(`${base}bsSubstationController.do?doDel`, params); };

export const batchRemoveList = params => { return axios.post(`${base}bsSubstationController.do?doBatchDel`, params); };

export const editList = params => { return axios.post(`${base}bsSubstationController.do?doUpdate`, params); };

export const addList = params => { return axios.post(`${base}bsSubstationController.do?doAdd`, params); };


// 问题库
export const geteqList = params => { return axios.post(`${base}equipmentProblemController/datagrid.do`, params); };
// 新增
export const addeqList = params => { return axios.post(`${base}equipmentProblemController/doAdd.do`, params); };
// 跟踪处理
export const follow = params => { return axios.post(`${base}equipmentProblemController/doSaveTrack.do`, params); };
// 消除验收
export const clear = params => { return axios.post(`${base}equipmentProblemController/doAccepter.do`, params); };
// 删除
export const delteTable = params => { return ajax.postData({url:`${base}equipmentProblemController/doDel.do`, params}); };
// 查看详细
export const vieweqDetal2 = params => { return axios.post(`${base}equipmentProblemController/getProblemTrackInfo.do`, params); };
// 导入
export const geteqInfo = params => { return axios.post(`${base}equipmentProblemController/upload`, params); };
// 导出
export const geteqDownload = params => { return axios.post(`${base}equipmentProblemController/export.do`, params); };
// 模板下载equipmentProblemController.do?download
export const geteqLoad = params => { return axios.post(`${base}equipmentProblemController/download.do`, params); };
// 变电站
export const getSub = params => { return axios.post(`${base}bsSubstationController.do?getList`, params); };
// 发现人员
export const getUse = params => { return axios.post(`${base}groupUserController.do?getAnnouncementList`, params); };


//约工列表
export const getappList = params => { return axios.post(`${base}appointmentController/datagrid.do`, params); };
//处理预约
export const dealAppointment = params => { return axios.post(`${base}appointmentController/doUpdate.do`, params); };
//流程类别
export const getAllTypeForTree = params => { return axios.post(`${base}tbTacheTypeController.do?getAllTypeForTree`, params); };
// 约工管理
// 单位表格数据列表
export const departData = params => { return axios.post(`${base}outsourcingDeptController/datagrid.do`, params); };
// 单位表格删除
export const departDel = params => { return axios.post(`${base}outsourcingDeptController/doDel.do`, params); };
// 单位表格录入
export const departAdd = params => { return axios.post(`${base}outsourcingDeptController/doAdd.do`, params); };
// 单位表格编辑
export const departEdit = params => { return axios.post(`${base}outsourcingDeptController/doUpdate.do`, params); };
// 人员表格数据列表
export const personData = params => { return axios.post(`${base}outsourcingPersonController/datagrid.do`, params); };
// 人员表格删除
export const personDel = params => { return axios.post(`${base}outsourcingPersonController/doDel.do`, params); };
// 人员表格录入
export const personAdd = params => { return axios.post(`${base}outsourcingPersonController/doAdd.do`, params); };
// 人员表格编辑
export const personEdit = params => { return axios.post(`${base}outsourcingPersonController/doUpdate.do`, params); };


/**
*学习列表
*/
// 获取列表
export const getLearnList = params => { return ajax.getMinData({url:`${base}learningController/datagrid.do`, params}); };
// 查看
export const checkLearnList = params => { return axios.post(`${base}learningController/getLearningById.do`, params); };
// 编辑
export const learnListEdit = params => { return axios.post(`${base}learningController/doUpdate.do`, params); };
// 删除
export const removeLists = params => { return axios.post(`${base}learningController/doDel.do`, params); };
// 导出
export const downWord = params => { return axios.post(`${base}learningController/exportWord.do`, params); };
// 发布学习
export const learnAdd = params => { return axios.post(`${base}learningController/doAdd.do`, params); };


/**
*通知列表
*/
// 获取列表
export const getAnnounceList = params => { return ajax.getMinData({url:`${base}announcementController/datagrid.do`, params}); };
// 查看
export const checkAnnounceList = params => { return axios.post(`${base}announcementController/getAnnouncementById.do`, params); };
// 编辑
export const AnnListEdit = params => { return axios.post(`${base}announcementController/doUpdate.do`, params); };
// 删除
export const removeAnnLists = params => { return axios.post(`${base}announcementController/doDel.do`, params); };
// 发布通知
export const getusersList = params => { return axios.post(`${base}departController.do?userDatagrid`, params); };
// 发布通知人员列表
export const announceAdd = params => { return axios.post(`${base}announcementController/doAdd.do`, params); };



/**
*知识库管理
*/
//知识库类别列表数据
export const knowledgeBaseType = params => { return axios.post(`${base}knowledgeBaseTypeController.do?datagrid`, params); };
//知识库类别删除
export const knowledgeDel = params => { return axios.post(`${base}knowledgeBaseTypeController.do?doDel`, params); };
//知识库类别录入
export const knowledgeAdd = params => { return axios.post(`${base}knowledgeBaseTypeController.do?doAdd`, params); };
//知识库类别编辑
export const knowledgeUpdate = params => { return axios.post(`${base}knowledgeBaseTypeController.do?doUpdate`, params); };
//知识库列表
export const knowledgeBase = params => { return ajax.getMinData({url:`${base}knowledgeBaseController/datagrid.do`, params}); };


/*二维码应用*/
/*二维码管理*/
//获取类型树形菜单数据
export const findToolTypeList = params => { return axios.post(`${base}api/tool/findToolTypeList.do?`, params); };
//新增二维码中的添加工具
export const addTool = params => { return axios.post(`${base}api/tool/addTool.do?`, params); };
//获取表格数据
export const getToolsList = params => { return axios.post(`${base}api/tool/getToolsList.do?`, params); };
//下载二维码模板
export const downloadModel = params => { return axios.post(`${base}api/tool/downloadModel.do?`, params); };
//获取操作日志列表
export const getToolsLogList  = params => { return ajax.postData({url:`${base}api/tool/getToolsLogList.do`, params:params}) };
//获取操作日志详情
export const getToolsLogDetail  = params => { return ajax.postData({url:`${base}/api/tool/getToolsLogDetail.do`, params:params}) };
//编辑材料接口
export const updateTool  = params =>{ return axios.post(`${base}api/tool/updateTool.do?`, params); };
//删除材料接口
export const removeTool  = params =>{ return axios.post(`${base}api/tool/removeTool.do?`, params); };
//添加选择列表条目列表
export const exportData  = params =>{ return axios.post(`${base}api/tool/exportData.do?`, params); };



// 关系管理

// 用户管理
// 获取列表
export const userManageList = params => { return axios.post(`${base}userController.do?datagrid`, params); };
// 获取角色列表
export const roleList = params => { return axios.post(`${base}userController.do?userRoleData`, params); };
// 添加角色列表
export const roleAddList = params => { return axios.post(`${base}userController.do?selRoleData`, params); };
// 部门列表
export const departList = params => { return axios.post(`${base}departController.do?setPFunction`, params); };
// 用户录入
export const addUserMa = params => { return ajax.postData({url:`${base}userController.do?saveUser`, params}); };
// 用户编辑userController.do?addorupdate
export const editUserMa = params => { return ajax.postData({url:`${base}userController.do?saveUser`, params}); };
// 用户删除
export const delUserMa = params => { return ajax.postData({url:`${base}userController.do?del`, params}); };
// 角色删除
export const delRole = params => { return ajax.postData({url:`${base}userController.do?delUserRole`, params}); };
// 重置密码
export const resetPw = params => { return ajax.postData({url:`${base}userController.do?savenewpwd`, params}); };
// 锁定用户
export const lockUser = params => { return ajax.postData({url:`${base}userController.do?lock`, params}); };
// 激活用户
// export const activeUser = params => { return axios.post(`${base}userController.do?lock`, params); };
// 添加角色
export const addUserRole = params => { return ajax.postData({url:`${base}userController.do?saveUserRole`, params}); };



// 角色管理
// 获取列表
export const roleMaList = params => { return axios.post(`${base}roleController.do?roleGrid`, params); };
// 获取查看成员左边列表
export const memberList1 = params => { return axios.post(`${base}roleController.do?userDatagrOutid`, params); };
// 获取查看成员右边列表
export const memberList2 = params => { return axios.post(`${base}roleController.do?userDatagrInid`, params); };
// 权限设置左边树
export const setAuthority = params => { return axios.post(`${base}roleController.do?setAuthority`, params); };
// 角色录入/编辑
export const saveRole = params => { return ajax.postData({url:`${base}roleController.do?saveRole`, params}); };
// 角色删除
export const deletRole = params => { return ajax.postData({url:`${base}roleController.do?delRole`, params}); };
// 权限菜单列表保存
export const updateAuthority = params => { return ajax.postData({url:`${base}roleController.do?updateAuthority`, params}); };
// 查看成员左边列表添加
export const addRoleUser = params => { return ajax.postData({url:`${base}roleController.do?addRoleUser`, params}); };
// 查看成员右边列表删除
export const deleteRoleUser = params => { return ajax.postData({url:`${base}roleController.do?deleteRoleUser`, params}); };
// roleController.do?operationListForFunction&functionId=390663443046207488&roleId=8afc99b04c26ad0b014c26af28900042&_=1498010180056
export const operationList = params => { return ajax.postData({url:`${base}roleController.do?getOperationListForFunction`, params}); };
// roleController.do?updateOperation
export const updateOperation = params => { return ajax.postData({url:`${base}roleController.do?updateOperation`, params}); };

// 部门管理
// 获取列表
export const depList = params => { return axios.post(`${base}departController.do?departgrid`, params); };
// 上级部门树
export const getDepComboTree = params => { return axios.post(`${base}departController.do?getDepComboTree`, params); };
// 部门录入检测部门名
export const checkdepart = params => { return axios.post(`${base}departController.do?checkdepart`, params); };
// 部门录入
export const save = params => { return ajax.postData({url:`${base}departController.do?save`, params}); };
// 获取部门信息
export const getDepartData = params => { return axios.post(`${base}departController.do?getDepartData`, params); };
// 部门删除
export const departContDel = params => { return ajax.postData({url:`${base}departController.do?del`, params}); };
// 获取用户列表
export const userDatagrid = params => { return axios.post(`${base}departController.do?userDatagrid`, params); };
// 用户列表删除
export const del = params => { return ajax.postData({url:`${base}userController.do?del`, params}); };
// 获取用户信息
export const getUserData = params => { return axios.post(`${base}userController.do?getUserData`, params); };


//数据字典
//获取列表
export const dataList = params => { return axios.post(`${base}systemController.do?typeGroupGrid`, params); };
// 获取数据字典分组信息
export const getTypeGroupData = params => { return axios.post(`${base}systemController.do?getTypeGroupData`, params); };
// 获取数据字典信息
export const getTypeData = params => { return axios.post(`${base}systemController.do?getTypeData`, params); };
// 字典项列表
export const ditionaryList = params => { return axios.post(`${base}systemController.do?getTypeTree`, params); };
// 字典录入
export const addData = params => { return ajax.postData({url:`${base}systemController.do?saveTypeGroup`, params}); };
// 字典编辑
export const eaitData = params => { return ajax.postData({url:`${base}systemController.do?saveTypeGroup`, params}); };
//字典删除
export const delTypeGroup = params => { return ajax.postData({url:`${base}systemController.do?delTypeGroup`, params}); };
// 字典项添加
export const getTypeComboTree = params => { return axios.post(`${base}systemController.do?getTypeComboTree`, params); };
// 字典项添加提交
export const saveType = params => { return ajax.postData({url:`${base}systemController.do?saveType`, params}); };
// 字典项删除
export const delType = params => { return ajax.postData({url:`${base}systemController.do?delType`, params}); };

//菜单管理
//获取列表
export const getMenuList = params => { return axios.post(`${base}functionController.do?functionGrid`, params);};
//添加菜单
export const addMenu = params => { return axios.post(`${base}functionController.do?saveFunction`, params);};
//删除菜单
export const delMenu = params => { return axios.post(`${base}functionController.do?del`, params);};
//获取按钮设置
export const getBtnSetting = params => { return axios.post(`${base}functionController.do?opdategrid`, params);};
//获取操作录入
export const addControl = params => { return axios.post(`${base}functionController.do?saveop`, params);};
//删除操作
export const delControl = params => { return axios.post(`${base}functionController.do?delop`, params);};
//获取菜单详情
export const getMenuDetail = params => {return axios.post(`${base}functionController.do?getFunctionData`,params);};
//获取权限菜单
export const getAuthMenu = params => { return ajax.getMinData({url:`${base}api/authController/getAuthMenu.do`, params}); };
//获取菜单操作权限
export const getAuthMenuOperation = params => { return ajax.getMinData({url:`${base}api/authController/getAuthMenuOperation.do`, params}); };
// 根据角色获取所有部门  parentid   api/appHomeControler/getAllDepart.do
export const getAllDepart = params => { return ajax.getMinData({ url: `${base}api/appHomeControler/getAllDepart.do`, params:params}) };
// 根据数据规则获取所有部门  
export const getDepartZtree = params => { return ajax.getMinData({url:`${base}api/authController/getDepartZtree.do`, params:params}) };



